package com.example.administrator.taxicar.ui.activity;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;

import com.example.administrator.taxicar.R;

import cn.pedant.SweetAlert.SweetAlertDialog;

public class XiaoxiActivity extends Activity implements View.OnClickListener{

    private LinearLayout linearLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //声明使用自定义标题
        setContentView(R.layout.activity_xiaoxi_layout);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.xiaoxi_titlebar_layout);//自定义布局赋

        linearLayout= (LinearLayout) findViewById(R.id.linearLayout);
        findViewById(R.id.title_left_img).setOnClickListener(this);


        final SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE)
                .setTitleText("正在加载数据");
        pDialog.show();
        pDialog.setCancelable(false);
        new CountDownTimer(800 * 2, 800) {
            public void onTick(long millisUntilFinished) {
                pDialog.getProgressHelper().setBarColor(Color.parseColor("#0392ff"));
            }
            public void onFinish() {
                pDialog.dismiss();
                linearLayout.setVisibility(View.VISIBLE);
            }
        }.start();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_left_img:
                finish();
                break;
        }
    }
}
